package com.topisv.tms.repository.send;

import java.sql.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.send.SendOut;

public interface SendOutDao extends PagingAndSortingRepository<SendOut,Long>,JpaSpecificationExecutor<SendOut>{
	public SendOut findByLogisticNumber(String logisticNumber);
	
	@Query("select t from SendOut t where  t.warehouseCode=?1 and t.sendTime between ?2 and ?3  order by t.logisticNumber,t.customerCode")
	public List<SendOut> findTodayLogistic(String warehouseCode,Date start,Date end);
	
	@Query("select t from SendOut t where  t.sendCode = ?1 order by t.id ")  
	 List<SendOut> findListBySendOut(String sendCode);
	
	@Modifying
	@Query("update SendOut t set printTime = ?1 where  t.sendCode = ?2  ")  
	void updateSendOutPrintTime(java.util.Date now, String sendCode);
}
